from time import sleep

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from tool.debug_util import debug_add_html_in_page
from lxml import etree

def t(driver):
    print(driver.current_url)

    source = driver.page_source
    print(source)
    html = etree.HTML(source)
    # todo xpath //*[@id="merge-all-comment-container"]/div/div[3]/div[1] //*[@id="merge-all-comment-container"]/div/div[3]/div[2]
    comments1 = html.cssselect('#merge-all-comment-container > div > div.comment-mainContent')
    print(comments1)
    comment1 = comments1[0].cssselect('div')

    # print(html.xpath('//*[@id="merge-all-comment-container"]/div/div[@data-e2e="comment-list"]'))

    comments2 = html.xpath('//*[@id="merge-all-comment-container"]/div/div[contains(@class,"comment-mainContent")]')
    comment2 = comments2[0].xpath('//div')
    # 以下不行
    # print(html.xpath('//*[@id="merge-all-comment-container"]/div/div[@class="comment-mainContent"]'))






